home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 423_01 / recio200 / rputf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-15  |  1.5 KB  |  39 lines

  1. /*****************************************************************************
  2.    MODULE: rputf.c
  3.   PURPOSE: recio character delimited floating point input functions
  4. COPYRIGHT: (C) 1994 William Pierpoint
  5.  COMPILER: Borland C Version 3.1
  6.        OS: MSDOS Version 6.2
  7.   VERSION: 2.00
  8.   RELEASE: April 15, 1994
  9. *****************************************************************************/
  10.  
  11. #include <errno.h>
  12. #include <float.h>
  13. #include <limits.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17.  
  18. #include "_rputf.h"
  19.  
  20. /****************************************************************************/
  21. char *                       /* return pointer to string                    */
  22.     dtoa(                    /* convert floating point number to string     */
  23.         double d,            /* number to convert                           */
  24.         int    dig,          /* number of significant digits                */
  25.         char  *str)          /* string buffer to use                        */
  26. /****************************************************************************/
  27. {
  28.     sprintf(str, "%.*G", dig, d);
  29.     return str;
  30. }
  31.  
  32. /****************************************************************************/
  33. /* rput_fn() - define rput functions                                        */
  34. /****************************************************************************/
  35.  
  36. rput_fn(float,  rputf, double, dtoa, FLT_DIG) 
  37. rput_fn(double, rputd, double, dtoa, DBL_DIG)
  38.  
  39.